import requset from "@/utils/request";
import qs from "qs";
enum URL {
  SystemUser = '/v1/admin/system/user/index',
  SystemUserDel = '/v1/admin/system/user/delete',
  SystemUserAdd = '/v1/admin/system/user/insert',
  SystemUserUpdate = '/v1/admin/system/user/update',
  SystemUserFind = '/v1/admin/system/user/find',
  SystemUserDisabled = '/v1/admin/system/user/disable'
}

const sysUserList = async (params:APISYSTEMUSER.SysUserParams) => requset<APISYSTEMUSER.SysUserList>({ url: URL.SystemUser, method:'GET', params });

const sysUserDel = async (id:string) => requset({ url: URL.SystemUserDel, method:'DELETE', data:{id} });

const sysUserFind = async (id:string) => requset({ url: URL.SystemUserFind, method:'GET', params:{id} });

const sysUserAdd = async (data:APISYSTEMUSER.AddUser) => requset({ url: URL.SystemUserAdd, method:'POST', data:qs.stringify(data) });

const sysUserUpdate = async (data:APISYSTEMUSER.UpdateUser) => requset({ url: URL.SystemUserUpdate, method:'PUT', data:qs.stringify(data) });

const sysUserDisabled = async (data: { id:string,disabled:0|1 }) => requset({ url: URL.SystemUserDisabled, method:'POST', data:qs.stringify(data) });

export default { sysUserList,sysUserDel,sysUserAdd,sysUserUpdate,sysUserFind,sysUserDisabled};
